<?php session_start(); ?>
<?php include("../inc/db_config.inc"); ?>
<?php 
$g_title="我的资料";
$g_tab="index";
$stab="profile";
$g_header=""; 
$g_js='<script type="text/javascript">
  $(document).ready(function(){
    
    $("#edit").click(function(){
        $(".profile").find(".dn").show();
        $(".old").hide();
        $("#regdate").hide();
    })
    $("#edit").toggle(function(){
        $(this).html("撤销");
        $(".profile").find(".dn").show();
        $(".old").hide();
        $("#regdate").hide();
        $("#submit").show();
    },function(){
        $(this).html("编辑");
        $(".profile").find(".dn").hide();
        $(".old").show();
        $("#regdate").show();
        $("#submit").hide();
    })
    
    
  })
</script>';
?>
 <?php include('header.php'); ?>
			<div class="crumb"></div>
			<div class="main">
				<div class="container r">
					<div class="conbox">
						<div class="cb_hd">
							<span class="cb_tl"></span>
							<span class="cb_tr"></span>
							<h2>我的资料</h2>
						</div>
						<div class="cb_bd">
								<div class="profile">
                                <?php
                                 $result=mysql_query("select * from user where id=1");
                                 $row=mysql_fetch_array($result);
                                ?>
									<div><a id="edit" href="javascript:void(0)">编辑</a></div>
                                    <form action="profile_update.php" method="post">
									<p>
										<label>用户名:</label><span><?php echo $row['username']; ?></span>
									</p>
									<p>
										<label>昵称:</label><span class="old"><?php echo $row['realname']; ?></span><input name="realname" class="dn" type="text" value="<?php echo $row['realname']; ?>" />
									</p>
									<p>
										<label>性别:</label><span class="old"><?php echo $row['sex']; ?></span><select name="sex" class="dn"><option value="男" <?php if($row['sex']=="男") echo "selected='selected'"; ?>>男</option><option value="女" <?php if($row['sex']=="女") echo "selected='selected'"; ?>>女</option></select>
									</p>
									<p>
										<label>出生日期:</label><span class="old"><?php echo $row['birth']; ?></span><input name="birth" class="dn" type="text" value="<?php echo $row['birth']; ?>" />
									</p>
									<p>
										<label>电子信箱:</label><span class="old"><?php echo $row['email']; ?></span><input name="email" class="dn" type="text" value="<?php echo $row['email']; ?>" />
									</p>
									<p>
										<label>联系电话:</label><span class="old"><?php echo $row['tel']; ?></span><input name="tel" class="dn" type="text" value="<?php echo $row['tel']; ?>" />
									</p>
									<p>
										<label>现居地址:</label><span class="old"><?php echo $row['address']; ?></span><input name="address" class="dn" type="text" value="<?php echo $row['address']; ?>" />
									</p>
									<p>
										<label>QQ:</label><span class="old"><?php echo $row['qq']; ?></span><input name="qq" class="dn" type="text" value="<?php echo $row['qq']; ?>" />
									</p>
									<p id="regdate">
										<label>注册日期:</label><span><?php echo $row['regdate']; ?></span>
									</p>
									<p class="dn">
										<input id="submit" class="sub" type="submit" value="提交"/>
									</p>
                                    </form>
								</div>
						</div>
						<div class="cb_ft"></div>
					</div>
				</div>
				<?php include('sidebar.php'); ?>
				<div class="c"></div>
			</div>
		</div>
	</div>
<?php include('footer.php'); ?>
